<?php include $this->admin_tpl('meta');?>
<title>添加聚水潭</title>
<style>
.exp{margin:0px 0px 0px 125px;color:#555;font-size:12px;}
.exp span{color:#056ef4}
</style>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>公司名称：</label>
			 	<input type="text" class="input" name="company" placeholder="聚水潭公司名称" value="<?php echo $data['company'];?>">
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>公司简称：</label>
			 	<input type="text" class="input" value="<?php echo $data['short_name'];?>" placeholder="公司简称便于记忆" name="short_name">
			 </li>	
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>app_key：</label>
			 	<input type="text" class="input" value="<?php echo $data['app_key'];?>" placeholder="开放平台app_key" name="app_key">
			 </li>	
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>app_secret：</label>
			 	<input type="text" class="input" value="<?php echo $data['app_secret'];?>" placeholder="开放平台app_secret" name="app_secret">
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red"></span>access_token：</label>
			 	<input type="text" class="input" value="<?php echo $data['access_token'];?>" placeholder="访问令牌" name="access_token">
			 </li>	
			 <li class="yzm-explain-box"><label><span class="c-red"></span>refresh_token：</label>
			 	<input type="text" class="input" value="<?php echo $data['refresh_token'];?>" placeholder="刷新令牌" name="refresh_token">
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>是否自有商城：</label>
			 	<label class="label_radio"><input name="is_ziyou" type="radio" value="1" <?php echo  $data['is_ziyou']==1 ? 'checked' : '';?>> 是</label>
			 	<label class="label_radio"><input name="is_ziyou" type="radio" value="0" <?php echo  $data['is_ziyou']==0 ? 'checked' : '';?>> 否</label>
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>是否启用：</label>
			 	<label class="label_radio"><input name="status" type="radio" value="1" <?php echo  $data['status']==1 ? 'checked' : '';?>> 是</label>
			 	<label class="label_radio"><input name="status" type="radio" value="0" <?php echo  $data['status']==0 ? 'checked' : '';?>> 否</label>
			 </li>
			 <li class="yzm-explain-box"><label><span class="c-red">*</span>开始时间<span class="yzm-explain-box"><span class="yzm-explain">需要的商品资料最早建立时间</span></span></label>
			 	<input type="text" autocomplete="off" class="input-text laydate-icon" style="width:175px;height:30px;" name="start_time" id="start_time" value="<?php echo $data['start_time']?date('Y-m-d',$data['start_time']):''; ?>"></span>
			 </li>			 
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="db" value="jst_list">
			<input type="hidden" name="id" value="<?php echo $data['id'];?>">
			<input class="btn btn-primary radius" type="submit" value="提 交">
			<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
		</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">
	function dosub(obj){
		if(obj.company.value==''){
			layer.msg('公司名称不能为空！', {icon:2});
			return false;
		}
		if(obj.short_name.value==''){
			layer.msg('公司简称不能为空！', {icon:2});
			return false;
		}
		if(obj.app_key.value==''){
			layer.msg('app_key不能为空！', {icon:2});
			return false;
		}
		if(obj.app_secret.value==''){
			layer.msg('app_secret不能为空！', {icon:2});
			return false;
		}
		if(obj.start_time.value==''){
			layer.msg('请选择开始时间！', {icon:2});
			return false;
		}
        $.ajax({
            type: 'POST',
            url: '<?php echo U('public_save');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
	var start_time = {elem:'#start_time',format:'YYYY-MM-DD',min:'1999-01-01',max:'2099-01-01',istime:true,istoday:false,choose:function(datas){}
	};
	laydate(start_time);
</script> 

</body>
</html>